package com.zzl.finance.data.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.zzl.apidoc.annotation.ApidocModel;
import com.zzl.apidoc.annotation.ApidocModelProperty;
import com.zzl.general.common.utils.DoubleSerialize;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;

/**
 * @author : spp
 * @date : 2021/12/2 14:31
 */
@ApidocModel
@Data
public class BwBankShowDto {

    @ApidocModelProperty(description = "供应商开票授信额度id")
    private String id;
    @ApidocModelProperty(description = "金融机构的 id")
    private String financeInstitutyId;
    @ApidocModelProperty(description = "机构名称")
    private String instinctyName;

    @JsonSerialize(using = DoubleSerialize.class)
    @ApidocModelProperty(description = "凭证融资限额")
    private Double creditAllAmount;
    @ApidocModelProperty(description = "无额度限制勾选框，true 勾选，false不勾选")
    private Boolean creditLimitFlag;
    @JsonSerialize(using = DoubleSerialize.class)
    @ApidocModelProperty(description = "已用额度总额")
    private Double creditUsedAmount;
    @ApidocModelProperty(description = "剩余可用额度")
    private String creditSurplusAmount;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApidocModelProperty(description = "更新日期", validate = "yyyy-MM-dd")
    private Date updateTime;


    public String getCreditSurplusAmount() {
        if (StringUtils.isBlank(creditSurplusAmount)) {
            return "-";
        }
        return creditSurplusAmount;
    }
}
